#pragma once
class CThreadListener;

class CThread
{
private:
    unsigned long m_thread_id;
    bool m_make_success;
    static void* Wrapper(void* arg);
protected:
    int m_ret_val;
    CThreadListener* m_listener;
    virtual void Execute() = 0;
public:
    CThread(CThreadListener *listener);
    virtual ~CThread();
    void Run();
    void WaitFor();
    unsigned long GetThreadId();
    int GetResult();
};

class CThreadListener
{
public:
    virtual void NotifyOnFinished() = 0;
};

